clear
set more off

use $censustemp/1940data.dta, clear

set seed 828
keep serial
duplicates drop
sort serial
gen u = runiform()
keep if u<=0.01   
drop u

sort serial

save $censustemp/1940data_1pctserial.dta, replace

use $censustemp/1940data.dta, clear

sort serial

merge m:1 serial using $censustemp/1940data_1pctserial.dta
keep if _merge == 3
drop _merge


foreach var in relate race bpl mbpl fbpl{
	gen `var'd = `var'
	replace `var' = floor(`var'd/100)
}

/*
	gen raced = race
	replace race = floor(raced/100)
*/
	
save $censustemp/1940_1%.dta, replace





